home *** CD-ROM | disk | FTP | other *** search
- /* Simple main() to call a parser in another file */
-
- #include "tokens.h" // define TokenType
- #include "Expr.h" // define parser
- #include "DLGLexer.h" // define scanner
-
- // Have to define ANTLRToken so we can make one to send to DLG for it to fill
- typedef ANTLRCommonToken ANTLRToken;
-
- main()
- {
- ANTLRToken aToken; /* create a token to fill in for DLG */
- DLGFileInput in(stdin); /* create an input stream for DLG to get chars from */
- DLGLexer scan(&in,2000);/* create scanner reading from stdin with bufsize==2000 */
- ANTLRTokenBuffer pipe(&scan);
- scan.setToken(&aToken);
- Expr parser(&pipe); /* create a parser of type Expr hooked to the scanner */
- parser.init();
-
- parser.e(); /* start parsing at rule 'e' of that parser */
- }
-